package com.atguigu.tingshu.order.mapper;

import com.atguigu.tingshu.model.order.OrderDetail;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface OrderDetailMapper extends BaseMapper<OrderDetail> {

    /**
     * 根据订单号查询订单属性
     * @param id
     * @return
     */
    @Select("SELECT MIN(item_id) FROM order_detail WHERE order_id = #{id} GROUP BY order_id")
    Long selectItemIdByOrderId(@Param("id") Long id);
}
